from django.db import models
from django.contrib.auth.models import User


# Create your models here.
class Landmark(models.Model):
	lat = models.CharField(max_length = 20)
	lng = models.CharField(max_length = 20)
	name = models.CharField(max_length=20)
	is_dest = models.BooleanField(default=False)

	def __unicode__(self):
		return self.name

class Destination(models.Model):
	landmark = models.ForeignKey(Landmark, unique=True)
	times = models.CharField(max_length = 50)
	dest_name = models.CharField(max_length=20)

	def __unicode__(self):
		return self.dest_name



class Route(models.Model):
	landmarks = models.ManyToManyField(Landmark)
	desc = models.CharField(max_length=20)
	dest = models.ForeignKey(Destination, unique=True)

	def __unicode__(self):
		return self.desc



class UserProfile(models.Model):
#	url = models.URLField()
	home_address = models.TextField()
	user = models.ForeignKey(User, unique=True)
	route = models.ForeignKey(Route, unique=True)
	#TODO: for now we have just a single route for a user. We should expand on this later on!!
	#def __init__(self): 
	#user_obj, route_obj = , home_address_obj="hello"):
	#	self.user = user_obj
	#	self.route = route_obj
	#	self.home_address = home_address_obj

	def __unicode__(self):
		return self.user.username
